﻿Imports OMANE.Common.UI
Imports OMANE.Common
Imports System.ComponentModel
Imports PTIC_Util
Imports System.Windows.Input

Namespace ViewModels
    Public Class ViewModelSensibilites
        Inherits ViewModelCommand
        Implements IViewModelTabSection

        Sub New()
        End Sub
        Private _Model As ModelTauxGarantis
        Public Sub New(ByVal Model As ModelTauxGarantis, ByVal DisplayName As String, ByVal Command As ICommand)
            MyBase.DisplayName = DisplayName
            _Model = Model
            Title = "SENSIBILITES"
        End Sub

        Public Property Icone As String Implements Common.UI.IViewModelTabSection.Icone
        Public Property Title As String Implements Common.UI.IViewModelTabSection.Title
        Public Property IsClosable As Boolean Implements IViewModelTabSection.IsClosable

        Private _ChocTauxTechnique As IEnumerable = TestData.SimpleData
        Public ReadOnly Property ChocTauxTechnique As IEnumerable
            Get
                Try
                    _Model = Locator.ModelStatic
                    Dim tble As DataTable = _Model.ListeTraitements.TraitMoteurMethode1.simulations.SimulTx_TechA.resultats
                    Dim q = From e In tble Select X = CDbl(e(nomTx_TechA)), Y = CDbl(e("S/P"))
                    Return q.AsEnumerable()
                Catch ex As Exception
                    Return _ChocTauxTechnique
                    Return Nothing
                End Try
            End Get
        End Property

        Private _ChocDureesInitiales As IEnumerable = TestData.SimpleData
        Public ReadOnly Property ChocDureesInitiales As IEnumerable
            Get
                Try
                    _Model = Locator.ModelStatic
                    Dim tble As DataTable = _Model.ListeTraitements.TraitMoteurMethode1.simulations.SimulDuree_Actu.resultats
                    Dim q = From e In tble Select X = CDbl(e(nomDuree_Actu)), Y = CDbl(e("S/P"))
                    Return q.AsEnumerable()
                Catch ex As Exception
                    Return _ChocDureesInitiales
                    Return Nothing
                End Try
            End Get
        End Property

        Private _ChocTauxNominaux As IEnumerable = TestData.SimpleData
        Public ReadOnly Property ChocTauxNominaux As IEnumerable
            Get
                Try
                    _Model = Locator.ModelStatic
                    Dim tble As DataTable = _Model.ListeTraitements.TraitMoteurMethode1.simulations.SimulTxNom_Actu.resultats
                    Dim q = From e In tble Select X = CDbl(e(nomTxNom_Actu)), Y = CDbl(e("S/P"))
                    Return q.AsEnumerable()
                Catch ex As Exception
                    Return Nothing
                End Try
                Return _ChocTauxNominaux
            End Get
        End Property
       
        Private _EvolutionSPTauxGaranti As IEnumerable = TestData.SimpleData
        Public ReadOnly Property EvolutionSPTauxGaranti As IEnumerable
            Get
                Try
                    _Model = Locator.ModelStatic
                    Dim tble As DataTable = _Model.ListeTraitements.TraitMoteurMethode1.simulations.SimulTx_CommiContA.resultats
                    Dim q = From e In tble Select X = CDbl(e(nomTx_CommiContA)), Y = CDbl(e("S/P"))
                    Return q.AsEnumerable()
                Catch ex As Exception
                    Return _EvolutionSPTauxGaranti
                    Return Nothing
                End Try

            End Get
        End Property
      
        Private _EvolutionSPFraisGestion As IEnumerable = TestData.SimpleData
        Public ReadOnly Property EvolutionSPFraisGestion As IEnumerable
            Get
                Try
                    _Model = Locator.ModelStatic
                    Dim tble As DataTable = _Model.ListeTraitements.TraitMoteurMethode1.simulations.SimulTx_fraiGestA.resultats
                    Dim q = From e In tble Select X = CDbl(e(nomTx_fraiGestA)), Y = CDbl(e("S/P"))
                    Return q.AsEnumerable()
                Catch ex As Exception
                    Return _EvolutionSPFraisGestion
                    Return Nothing
                End Try
            End Get
        End Property
    End Class
End Namespace
